import django_filters
from apps.HttpTestcase.models import Projects


class ProjectFilters(django_filters.rest_framework.FilterSet):
    """
    项目过滤
    """
    # iexact表示精确匹配, 并且忽略大小写
    # icontains表示模糊查询（包含），并且忽略大小写
    # exact表示精确匹配
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')

    class Meta:
        model = Projects
        fields = ['name']